package cn.com.web.Servlet;

import cn.com.domain.Room;
import cn.com.service.RoomService;
import cn.com.service.impl.RoomServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/ShowRoomDetailsServlet")
public class ShowRoomDetailsServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        int room_id = Integer.parseInt(request.getParameter("room_id"));
        RoomService roomService=new RoomServiceImpl();
        Room room = roomService.findRoombyroom_id(room_id);
        request.setAttribute("room",room);
        request.getRequestDispatcher("roomDetailsa.jsp")
                .forward(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }
}
